%plot layer 2, 5 and [2 5] on same figure, for different thresholds
% thr 2 int 0  above threshold 2 is good
% thr 1.8 int 0 stats work


timepoints=[-48 -24 6 18 24 48];
thresh = [1.75];
integ = [0];
n=2.5; %line width

for i=1:length(thresh)
    for j=1:length(integ)
%         layer = [2 5];
%         [sig_diff_ttest25, l_c_mean, l_c_ste, l_e_mean, l_e_ste]=analyze_hom_data(hom_data,layer, thresh(i), integ(j));
        
         figure; 
         hold on
%         h=plot(timepoints, l_c_mean, 'ro', 'LineWidth', n);
%         h=errorbar(timepoints(1:2), l_c_mean(1:2), l_c_ste(1:2), 'r');set(h, 'LineWidth', n);
%         h=errorbar(timepoints(3:end), l_c_mean(3:end), l_c_ste(3:end), 'r');set(h, 'LineWidth', n);
%         h= plot(timepoints, l_e_mean, 'ko', 'LineWidth', n);
%         h=errorbar(timepoints(1:2), l_e_mean(1:2), l_e_ste(1:2), 'k');set(h, 'LineWidth', n);
%         h=errorbar(timepoints(3:end), l_e_mean(3:end), l_e_ste(3:end), 'k');set(h, 'LineWidth', n);
%         title(sprintf('threshold %d - integral %d - layer 2 and 5', thresh(i), integ(j)));
        
%         layer = 5;
%         [sig_diff_ttest5, l_c_mean, l_c_ste, l_e_mean, l_e_ste]=analyze_hom_data(hom_data,layer, thresh(i), integ(j));
%         h=plot(timepoints, l_c_mean, 'rs');set(h, 'LineWidth', n);
%         h=errorbar(timepoints(1:2), l_c_mean(1:2), l_c_ste(1:2), ':r');set(h, 'LineWidth', n);
%         h=errorbar(timepoints(3:end), l_c_mean(3:end), l_c_ste(3:end), ':r');set(h, 'LineWidth', n);
%         h=plot(timepoints, l_e_mean, 'ks', 'LineWidth', n);
%         h=errorbar(timepoints(1:2), l_e_mean(1:2), l_e_ste(1:2), ':k');set(h, 'LineWidth', n);
%         h= errorbar(timepoints(3:end), l_e_mean(3:end), l_e_ste(3:end), ':k');set(h, 'LineWidth', n);
%         title(sprintf('threshold %d - integral %d - layer %d', thresh(i), integ(j), layer ));
        
        layer = 2;
        [sig_diff_ttest2, l_c_mean, l_c_ste, l_e_mean, l_e_ste,cells_total,cells_good,c_mat,e_mat]=analyze_hom_data(hom_data,layer, thresh(i), integ(j));
        h=plot(timepoints, l_c_mean, 'rd', 'LineWidth', n);
        h=errorbar(timepoints(1:2), l_c_mean(1:2), l_c_ste(1:2), '-.r');set(h, 'LineWidth', n);
        h=errorbar(timepoints(3:end), l_c_mean(3:end), l_c_ste(3:end), '-.r');set(h, 'LineWidth', n);
        h=plot(timepoints, l_e_mean, 'kd', 'LineWidth', n);
        h=errorbar(timepoints(1:2), l_e_mean(1:2), l_e_ste(1:2), '-.k');set(h, 'LineWidth', n);
        h=errorbar(timepoints(3:end), l_e_mean(3:end), l_e_ste(3:end), '-.k'); set(h, 'LineWidth', n);
        title(sprintf('threshold %d - integral %d - layer %d', thresh(i), integ(j), layer ));
    end
    
end
